package com.hamster.crm.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hamster.crm.pojo.dto.UserAndRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

/**
 * @author Tarry
 * @create 2020/1/2 13:38
 */
@Repository
@Mapper
public interface UserAndRoleMapper extends BaseMapper<UserAndRole> {

    /**
     * 查询该 权限角色关系是否存在
     * @param roleId
     * @param id
     */
    @Select("select count(*) from tb_user_role where role_id = #{roleId} and user_id = #{id}")
    Integer checkExistence(@Param("roleId") String roleId, @Param("id") String id);
}
